package commands;

import core.GameParticipant;
import core.GameParticipantRegistry;
import voting.Measure;

/**
 * Encapsulates the proposal of a <code>Measure</code> by a user. <code>Clients</code>
 * may vote yes or no by sending a <code>VoteCommand</code> after a <code>Measure</code>
 * has been called via this command.
 */
public class MeasureCommand extends Command
{
	public MeasureCommand() {
		this(null);
	}

	public MeasureCommand(Measure m) {
		measure = m;
	}

	public net.StateUpdate execute() throws CommandException
	{
		super.execute();
		GameParticipant gp = GameParticipantRegistry.get();
		System.out.println(Thread.currentThread());
		gp.notifyOfMeasure(measure);
		return null;
	}

	public Measure getMeasure() {
		return measure;
	}
	public void setMeasure(Measure measure) {
		this.measure = measure;
	}

	private Measure measure;
}